<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
   pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="support.*,java.util.*"%>
<html>
<head>
<link rel="stylesheet" type="text/css" href="layout.css" />
<%
   student applicant = (student) session.getAttribute("applicant");
   int count = (Integer) session.getAttribute("count");
   session.setAttribute("count", count + 1);
   applicant.degreeMap.get(count).setdegType(
         (String) request.getParameter("title"));
   applicant.degreeMap.get(count)
         .setdegMonth(
               Integer.parseInt((String) request
                     .getParameter("month")) - 1);
   applicant.degreeMap.get(count).setdegYear(
         Integer.parseInt((String) request.getParameter("year")));
   applicant.degreeMap.get(count).setdegGPA(
         Double.parseDouble((String) request.getParameter("GPA")));

   if (request.getParameter("discipline") == null)
   {
      applicant.getMajors().add(request.getParameter("custMajor"));
      applicant.degreeMap.get(count).setdegDiscipline(
            applicant.getMajors().size() - 1);
   }
   else
   {
      applicant.degreeMap.get(count).setdegDiscipline(
            Integer.parseInt((String) request
                  .getParameter("discipline")));
   }
   //save the university selected from degreeUniv.jsp
   //int marker = Integer.parseInt((String)request.getParameter("university"));

   support s = new support();
   String path = config.getServletContext().getRealPath(
         "majors.txt");

   //getCountries returns a vector of the countries to be used for choosing citizenship
   Vector majors = s.getMajors(path);
%>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Degree Add more</title>
<h1>Degrees - Add more</h1>
</head>
<body>
   <table border=1>
      <tr>
         <th>ID</th>
         <th>Location</th>
         <th>University</th>
         <th>Discipline</th>
         <th>Month</th>
         <th>Year</th>
         <th>GPA</th>
         <th>Title</th>
      </tr>

      <%
         for (int i = 0; i < applicant.degreeMap.size(); i++)
         {
      %>
      <tr>
         <td><%=i%></td>
         <td><%=applicant.degreeMap.get(i).getState()%></td>
         <td><%=applicant.degreeMap.get(i).getDegreeUniversity()%></td>
         <td><%=applicant.getdegDiscipline(applicant.degreeMap
                  .get(i).getDiscipline())%></td>
         <td><%=applicant.getMonthVector().get(
                  applicant.degreeMap.get(i).getdegMonth())%></td>
         <td><%=applicant.degreeMap.get(i).getdegYear()%></td>
         <td><%=applicant.degreeMap.get(i).getdegGPA()%></td>
         <td><%=applicant.degreeMap.get(i).getdegType()%></td>
      </tr>
      <%
         }
      %>
   </table>


   <%
      session.setAttribute("count", count + 1);
   %>

   <br />
   <form method="POST" action="degreesLocation.jsp">
      <input type="submit" value="Submit Next Degree" /><br />
   </form>
   <form method="POST" action="specialization.jsp">
      <input type="submit" value="Done" /><br />
   </form>



</body>
</html>